// 日志输出内容,中间件
import { Context, Next } from "koa";
import { accessLogger } from "../logger";

function AccessLogMiddleware(ctx: Context, next: Next) {
  const logStr = `path:${ctx.path} | method: ${ctx.method} | ua:${ctx.header["user-agent"]}`;

  accessLogger.info(logStr);

  return next();
}

//在app.index中使用中间件
export default AccessLogMiddleware;
